package com.example.denglu.enums;

import com.example.denglu.config.exception.CommonError;

public enum ValidateRegexEnum {

    EMAIL("\"^([a-z0-9A-Z]+[-|_|\\\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\\\.)+[a-zA-Z]{2,}$\"",CommonError.FORMAT_MISMATCH),
    MOBILE("((^(13|15|17|18)[0-9]{9}$)|(^0[1,2]{1}\\d{1}-?\\d{8}$)|(^0[3-9] {1}\\d{2}-?\\d{7,8}$)|(^0[1,2]{1}\\d{1}-?\\d{8}-(\\d{1,4})$)|(^0[3-9]{1}\\d{2}-? \\d{7,8}-(\\d{1,4})$))",CommonError.FORMAT_MISMATCH),
    SPECIAL_CHARACTER("^%&',;=?$\\\"", CommonError.CONTAIN_SPECIAL_CHARACTER),
    DOMAIN("[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\\.?",CommonError.FORMAT_MISMATCH);

    private String regex;
    private CommonError commonError;
    ValidateRegexEnum(String regex, CommonError commonError){
        this.regex=regex;
        this.commonError=commonError;
    }

    public String getRegex() {
        return regex;
    }

    public void setRegex(String regex) {
        this.regex = regex;
    }

    public CommonError getCommonError() {
        return commonError;
    }

    public void setCommonError(CommonError commonError) {
        this.commonError = commonError;
    }

}
